﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Globalization;
using System.Text;
using System.Text.RegularExpressions;

namespace Nature.Data.GMixMarkup
{
	using Nature.Text;
	


	public partial class GMixTextSource : TextSource
	{
		public GMixTextSource(string text) : base(text) 
        {
            base.Initialize(); 
        }
	}

	[TextSource(typeof(GMixTextSource))]
	public partial class GMixTextFragment : TextFragment
	{
		protected static readonly TraceSource TextTrace = new TraceSource("GMixTextSource", SourceLevels.Critical);

		public GMixTextFragment(GMixTextSource source) : 
			base(source) { this.GMixTextSource  = source; }

		protected GMixTextFragment(GMixTextSource source, System.Text.RegularExpressions.Capture capture) : 
			base(source, capture) { this.GMixTextSource  = source; }

		protected  GMixTextFragment(GMixTextSource source, int index, int length) : 
			base(source, index, length) { this.GMixTextSource  = source; }

		public GMixTextSource GMixTextSource { get; private set; }

		internal class TextProgressArg : IDisposable 
		{			
            private Dictionary<string, string> m_stringsMap = new Dictionary<string, string>();
			internal readonly Stack<string> Stack = new Stack<string>();
			internal readonly ITextInfoEventListener Listener;

			internal string LogicalPath
			{
				get
				{
					StringBuilder sb = new StringBuilder();
					foreach(string node in this.Stack) { sb.AppendFormat("/{0}", node); }
					return sb.ToString();
				}
			}

			public TextProgressArg(GMixTextSource source, ITextInfoEventListener listener)
			{
				this.Source = source;
				this.Listener = listener;
			}

			public GMixTextSource Source
			{
				get;
				private set;
			}

            public string MapString(string s)
            {
                string mapped = s;
                if( m_stringsMap.TryGetValue(s, out mapped))
                {
                    return mapped;
                }
                else
                {
                    m_stringsMap.Add(s, s);
                }
                return s;
            }
        
			#region IDisposable Members

			void IDisposable.Dispose()
			{

			}

			#endregion
		}
	}

    

     
    /// <summary>
    /// GMixPressureUnits
    /// </summary>
    public enum GMixPUnits
    {  
        /// <summary>
        /// Atmosphere
        /// </summary>
        Atmosphere,  
        /// <summary>
        /// Bar
        /// </summary>
        Bar,  
        /// <summary>
        /// CentiBar
        /// </summary>
        CentiBar,  
        /// <summary>
        /// CentiPascal
        /// </summary>
        CentiPascal,  
        /// <summary>
        /// CentiPsi
        /// </summary>
        CentiPsi,  
        /// <summary>
        /// CentiTorr
        /// </summary>
        CentiTorr,  
        /// <summary>
        /// DeciBar
        /// </summary>
        DeciBar,  
        /// <summary>
        /// DeciPascal
        /// </summary>
        DeciPascal,  
        /// <summary>
        /// DeciPsi
        /// </summary>
        DeciPsi,  
        /// <summary>
        /// DeciTorr
        /// </summary>
        DeciTorr,  
        /// <summary>
        /// GigaBar
        /// </summary>
        GigaBar,  
        /// <summary>
        /// GigaPascal
        /// </summary>
        GigaPascal,  
        /// <summary>
        /// GigaPsi
        /// </summary>
        GigaPsi,  
        /// <summary>
        /// GigaTorr
        /// </summary>
        GigaTorr,  
        /// <summary>
        /// KiloBar
        /// </summary>
        KiloBar,  
        /// <summary>
        /// KiloPascal
        /// </summary>
        KiloPascal,  
        /// <summary>
        /// KiloPsi
        /// </summary>
        KiloPsi,  
        /// <summary>
        /// KiloTorr
        /// </summary>
        KiloTorr,  
        /// <summary>
        /// MegaBar
        /// </summary>
        MegaBar,  
        /// <summary>
        /// MegaPascal
        /// </summary>
        MegaPascal,  
        /// <summary>
        /// MegaPsi
        /// </summary>
        MegaPsi,  
        /// <summary>
        /// MegaTorr
        /// </summary>
        MegaTorr,  
        /// <summary>
        /// MicroBar
        /// </summary>
        MicroBar,  
        /// <summary>
        /// MicroPascal
        /// </summary>
        MicroPascal,  
        /// <summary>
        /// MicroPsi
        /// </summary>
        MicroPsi,  
        /// <summary>
        /// MicroTorr
        /// </summary>
        MicroTorr,  
        /// <summary>
        /// MilliBar
        /// </summary>
        MilliBar,  
        /// <summary>
        /// MilliPascal
        /// </summary>
        MilliPascal,  
        /// <summary>
        /// MilliPsi
        /// </summary>
        MilliPsi,  
        /// <summary>
        /// MilliTorr
        /// </summary>
        MilliTorr,  
        /// <summary>
        /// NanoBar
        /// </summary>
        NanoBar,  
        /// <summary>
        /// NanoPascal
        /// </summary>
        NanoPascal,  
        /// <summary>
        /// NanoPsi
        /// </summary>
        NanoPsi,  
        /// <summary>
        /// NanoTorr
        /// </summary>
        NanoTorr,  
        /// <summary>
        /// Pascal
        /// </summary>
        Pascal,  
        /// <summary>
        /// Psi
        /// </summary>
        Psi,  
        /// <summary>
        /// Torr
        /// </summary>
        Torr  
    }

    public partial class GMixPressureUnits : GMixTextFragment
    {  
        public static readonly Regex AtmosphereRegex = new Regex(@"^\s*(?:(?:atm(?:osphere)?))\s*$", RegexOptions.Compiled);  
        public static readonly Regex BarRegex = new Regex(@"^\s*(?:(?:bar))\s*$", RegexOptions.Compiled);  
        public static readonly Regex CentiBarRegex = new Regex(@"^\s*(?:(?:centi(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex CentiPascalRegex = new Regex(@"^\s*(?:(?:centi(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex CentiPsiRegex = new Regex(@"^\s*(?:(?:centi(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex CentiTorrRegex = new Regex(@"^\s*(?:(?:centi(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex DeciBarRegex = new Regex(@"^\s*(?:(?:deci(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex DeciPascalRegex = new Regex(@"^\s*(?:(?:deci(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex DeciPsiRegex = new Regex(@"^\s*(?:(?:deci(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex DeciTorrRegex = new Regex(@"^\s*(?:(?:deci(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex GigaBarRegex = new Regex(@"^\s*(?:(?:giga(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex GigaPascalRegex = new Regex(@"^\s*(?:(?:giga(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex GigaPsiRegex = new Regex(@"^\s*(?:(?:giga(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex GigaTorrRegex = new Regex(@"^\s*(?:(?:giga(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloBarRegex = new Regex(@"^\s*(?:(?:kilo(?:bar)|k(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloPascalRegex = new Regex(@"^\s*(?:(?:kilo(?:pasc(?:al)?)|k(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloPsiRegex = new Regex(@"^\s*(?:(?:kilo(?:psi)|k(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex KiloTorrRegex = new Regex(@"^\s*(?:(?:kilo(?:torr)|k(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MegaBarRegex = new Regex(@"^\s*(?:(?:mega(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MegaPascalRegex = new Regex(@"^\s*(?:(?:mega(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MegaPsiRegex = new Regex(@"^\s*(?:(?:mega(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MegaTorrRegex = new Regex(@"^\s*(?:(?:mega(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MicroBarRegex = new Regex(@"^\s*(?:(?:micro(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MicroPascalRegex = new Regex(@"^\s*(?:(?:micro(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MicroPsiRegex = new Regex(@"^\s*(?:(?:micro(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MicroTorrRegex = new Regex(@"^\s*(?:(?:micro(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MilliBarRegex = new Regex(@"^\s*(?:(?:milli(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MilliPascalRegex = new Regex(@"^\s*(?:(?:milli(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MilliPsiRegex = new Regex(@"^\s*(?:(?:milli(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex MilliTorrRegex = new Regex(@"^\s*(?:(?:milli(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex NanoBarRegex = new Regex(@"^\s*(?:(?:nano(?:bar)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex NanoPascalRegex = new Regex(@"^\s*(?:(?:nano(?:pasc(?:al)?)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex NanoPsiRegex = new Regex(@"^\s*(?:(?:nano(?:psi)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex NanoTorrRegex = new Regex(@"^\s*(?:(?:nano(?:torr)))\s*$", RegexOptions.Compiled);  
        public static readonly Regex PascalRegex = new Regex(@"^\s*(?:(?:pasc(?:al)?))\s*$", RegexOptions.Compiled);  
        public static readonly Regex PsiRegex = new Regex(@"^\s*(?:(?:psi))\s*$", RegexOptions.Compiled);  
        public static readonly Regex TorrRegex = new Regex(@"^\s*(?:(?:torr))\s*$", RegexOptions.Compiled);  

		public GMixPressureUnits(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixPressureUnits(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal GMixPressureUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixPressureUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public GMixPUnits GMixPUnits { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( AtmosphereRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.Atmosphere; }  
            else if( BarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.Bar; }  
            else if( CentiBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.CentiBar; }  
            else if( CentiPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.CentiPascal; }  
            else if( CentiPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.CentiPsi; }  
            else if( CentiTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.CentiTorr; }  
            else if( DeciBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.DeciBar; }  
            else if( DeciPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.DeciPascal; }  
            else if( DeciPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.DeciPsi; }  
            else if( DeciTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.DeciTorr; }  
            else if( GigaBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.GigaBar; }  
            else if( GigaPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.GigaPascal; }  
            else if( GigaPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.GigaPsi; }  
            else if( GigaTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.GigaTorr; }  
            else if( KiloBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.KiloBar; }  
            else if( KiloPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.KiloPascal; }  
            else if( KiloPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.KiloPsi; }  
            else if( KiloTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.KiloTorr; }  
            else if( MegaBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MegaBar; }  
            else if( MegaPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MegaPascal; }  
            else if( MegaPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MegaPsi; }  
            else if( MegaTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MegaTorr; }  
            else if( MicroBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MicroBar; }  
            else if( MicroPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MicroPascal; }  
            else if( MicroPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MicroPsi; }  
            else if( MicroTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MicroTorr; }  
            else if( MilliBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MilliBar; }  
            else if( MilliPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MilliPascal; }  
            else if( MilliPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MilliPsi; }  
            else if( MilliTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.MilliTorr; }  
            else if( NanoBarRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.NanoBar; }  
            else if( NanoPascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.NanoPascal; }  
            else if( NanoPsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.NanoPsi; }  
            else if( NanoTorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.NanoTorr; }  
            else if( PascalRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.Pascal; }  
            else if( PsiRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.Psi; }  
            else if( TorrRegex.IsMatch(this) ){ this.GMixPUnits = GMixPUnits.Torr; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// GMixTemperatureUnits
    /// </summary>
    public enum GMixTUnits
    {  
        /// <summary>
        /// Celsius
        /// </summary>
        Celsius,  
        /// <summary>
        /// Fahrenheit
        /// </summary>
        Fahrenheit,  
        /// <summary>
        /// Kelvin
        /// </summary>
        Kelvin,  
        /// <summary>
        /// Rankine
        /// </summary>
        Rankine  
    }

    public partial class GMixTemperatureUnits : GMixTextFragment
    {  
        public static readonly Regex CelsiusRegex = new Regex(@"^\s*(?:(?:cel(?:sius)?))\s*$", RegexOptions.Compiled);  
        public static readonly Regex FahrenheitRegex = new Regex(@"^\s*(?:(?:fahrenheit))\s*$", RegexOptions.Compiled);  
        public static readonly Regex KelvinRegex = new Regex(@"^\s*(?:(?:k(?:elv(?:in)?)?))\s*$", RegexOptions.Compiled);  
        public static readonly Regex RankineRegex = new Regex(@"^\s*(?:(?:rankine))\s*$", RegexOptions.Compiled);  

		public GMixTemperatureUnits(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixTemperatureUnits(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal GMixTemperatureUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixTemperatureUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public GMixTUnits GMixTUnits { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( CelsiusRegex.IsMatch(this) ){ this.GMixTUnits = GMixTUnits.Celsius; }  
            else if( FahrenheitRegex.IsMatch(this) ){ this.GMixTUnits = GMixTUnits.Fahrenheit; }  
            else if( KelvinRegex.IsMatch(this) ){ this.GMixTUnits = GMixTUnits.Kelvin; }  
            else if( RankineRegex.IsMatch(this) ){ this.GMixTUnits = GMixTUnits.Rankine; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// GMixFractionType
    /// </summary>
    public enum FractionType
    {  
        /// <summary>
        /// X100
        /// </summary>
        X100,  
        /// <summary>
        /// Y100
        /// </summary>
        Y100,  
        /// <summary>
        /// X
        /// </summary>
        X,  
        /// <summary>
        /// Y
        /// </summary>
        Y  
    }

    public partial class GMixFractionType : GMixTextFragment
    {  
        public static readonly Regex X100Regex = new Regex(@"^\s*(?:x100%?)\s*$", RegexOptions.Compiled);  
        public static readonly Regex Y100Regex = new Regex(@"^\s*(?:y100%?)\s*$", RegexOptions.Compiled);  
        public static readonly Regex XRegex = new Regex(@"^\s*(?:x)\s*$", RegexOptions.Compiled);  
        public static readonly Regex YRegex = new Regex(@"^\s*(?:y)\s*$", RegexOptions.Compiled);  

		public GMixFractionType(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixFractionType(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal GMixFractionType(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixFractionType(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public FractionType FractionType { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( X100Regex.IsMatch(this) ){ this.FractionType = FractionType.X100; }  
            else if( Y100Regex.IsMatch(this) ){ this.FractionType = FractionType.Y100; }  
            else if( XRegex.IsMatch(this) ){ this.FractionType = FractionType.X; }  
            else if( YRegex.IsMatch(this) ){ this.FractionType = FractionType.Y; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

     
    /// <summary>
    /// GMixKnownItemType
    /// </summary>
    public enum KnownItemType
    {  
        /// <summary>
        /// Temperature
        /// </summary>
        Temperature,  
        /// <summary>
        /// Pressure
        /// </summary>
        Pressure,  
        /// <summary>
        /// BaseTemperature
        /// </summary>
        BaseTemperature,  
        /// <summary>
        /// BasePressure
        /// </summary>
        BasePressure,  
        /// <summary>
        /// CompressionRatio
        /// </summary>
        CompressionRatio,  
        /// <summary>
        /// MachNumber
        /// </summary>
        MachNumber,  
        /// <summary>
        /// EquivalenceRatio
        /// </summary>
        EquivalenceRatio,  
        /// <summary>
        /// MixtureFraction
        /// </summary>
        MixtureFraction  
    }

    public partial class GMixKnownItemType : GMixTextFragment
    {  
        public static readonly Regex TemperatureRegex = new Regex(@"^\s*(?:(?:temp(?>erature)?|t))\s*$", RegexOptions.Compiled);  
        public static readonly Regex PressureRegex = new Regex(@"^\s*(?:(?:pressure|press?|p))\s*$", RegexOptions.Compiled);  
        public static readonly Regex BaseTemperatureRegex = new Regex(@"^\s*(?:base\s*(?:temp(?>erature)?|t))\s*$", RegexOptions.Compiled);  
        public static readonly Regex BasePressureRegex = new Regex(@"^\s*(?:base\s*(?:pressure|press?|p))\s*$", RegexOptions.Compiled);  
        public static readonly Regex CompressionRatioRegex = new Regex(@"^\s*(?:comp(?>res(?>sion)?)?\s+ratio|cr)\s*$", RegexOptions.Compiled);  
        public static readonly Regex MachNumberRegex = new Regex(@"^\s*(?:mach(?>\s*num(?>ber)?)?)\s*$", RegexOptions.Compiled);  
        public static readonly Regex EquivalenceRatioRegex = new Regex(@"^\s*(?:eq(?>uivalence)?\s*ratio|er)\s*$", RegexOptions.Compiled);  
        public static readonly Regex MixtureFractionRegex = new Regex(@"^\s*(?:mix(?>ture)?\s*frac(>?tion)?|mf|z)\s*$", RegexOptions.Compiled);  

		public GMixKnownItemType(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixKnownItemType(TextProgressArg arg) : base(arg.Source) { Initialize(arg); }        
		internal GMixKnownItemType(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixKnownItemType(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

        public KnownItemType KnownItemType { get; private set; }

        void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
            if(false){}  
            else if( TemperatureRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.Temperature; }  
            else if( PressureRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.Pressure; }  
            else if( BaseTemperatureRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.BaseTemperature; }  
            else if( BasePressureRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.BasePressure; }  
            else if( CompressionRatioRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.CompressionRatio; }  
            else if( MachNumberRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.MachNumber; }  
            else if( EquivalenceRatioRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.EquivalenceRatio; }  
            else if( MixtureFractionRegex.IsMatch(this) ){ this.KnownItemType = KnownItemType.MixtureFraction; }  
            else
            { 
                listener.Submit(TextInfoType.Error, "Invalid format", this);  
            }
        }
    }

    
	 
	public partial class GMixExpression : GMixTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?>(?>\s*)(?>(?<component>(?>[[][^\r\n]]*[]]|[^{}\s]+)(?>\s*)[{].*?(?>[}]|$))|(?<defect>\S+)))+(?>\s*))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<GMixComponent> m_components = new List<GMixComponent>();  	
         	
         	

		public static GMixExpression Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<GMixExpression>(text);
		}


		public GMixExpression(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixExpression(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixExpression(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("GMixExpression");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["defect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "Invalid GMix expression", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["component"].Captures.Count; ++counter)
				{
					var capture = match.Groups["component"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <component> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_components.Add(new GMixComponent(arg, capture));
				}    

				 

				 

										
				   
				   
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

			


		 
		 
		public IEnumerable<GMixComponent> Components
        {
            get  { return new ReadOnlyCollection<GMixComponent>(m_components); }
        }  

		 	
	} 
     
	public partial class GMixComponent : GMixTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?>[[](?>\s*)(?<id>[^\r\n{}]*?)(?>\s*)[]]|(?<id>[^\s{}]*))(?>\s*)(?<open>[{])(?>(?>\s*)(?=\S)(?>(?<units>[[](?>\s*)\b(?:units)\b(?>\s*)[]](?:(?>(?![[])(?!(?>\s*)[^\s=]+(?>\s*)=)(?:(?>@param(?>eter)?(?>\s*)\[[^]{}]+\])|[^{}]))+))|(?<item>[^={}]+(?:(?>(?![[])(?!(?>\s*)[^\s=]+(?>\s*)=)(?:(?>@param(?>eter)?(?>\s*)\[[^]{}]+\])|[^{}]))+))|(?<defect>[^\s}]))(?>\s*))*(?<close-open>[}])?(?>\s*))$", RegexOptions.Compiled);
		 
		[DebuggerBrowsable(DebuggerBrowsableState.Never)]
		private readonly List<GMixComponentItem> m_items = new List<GMixComponentItem>();  	
         	
         	

		public static GMixComponent Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<GMixComponent>(text);
		}


		public GMixComponent(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixComponent(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixComponent(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("GMixComponent");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}   
				foreach(Capture capture in match.Groups["defect"].Captures)
				{  
					listener.Submit(TextInfoType.Error, "bla-bla-bla", this.Source, capture);  
					listener.Submit(TextInfoType.Warning, "Hello world!!!", this.Source, capture);  
					listener.Submit(TextInfoType.Information, "Hi there", this.Source, capture);  
				}  
				for(int counter = 0; counter < match.Groups["item"].Captures.Count; ++counter)
				{
					var capture = match.Groups["item"].Captures[counter];
					var position = arg.Source[capture.Index];
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
					{
						TextTrace.TraceEvent(TraceEventType.Information, 0, "Line {0}, column {1}: captured <item> group > capture index: {2}", position.Line, position.Column, counter);
						TextTrace.TraceData(TraceEventType.Information, 0, arg.Source.GetLine(position.Line));
					}
					m_items.Add(new GMixComponentItem(arg, capture));
				}    

				 
                for(int counter = 0; counter < match.Groups["id"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["id"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
					this.ComponentID = arg.MapString(capture.Value);   
				}  

				 

										
				 		
				for(int counter = 0; counter < match.Groups["units"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["units"].Captures[counter];
					this.Units = new GMixUnits(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				   
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ComponentID
        /// </summary>
		public string ComponentID { get; private set; }  	

			

			

			

			


		 
		public GMixUnits Units { get; private set; }  
		 
		public IEnumerable<GMixComponentItem> Items
        {
            get  { return new ReadOnlyCollection<GMixComponentItem>(m_items); }
        }  

		 	
	} 
     
	public partial class GMixUnits : GMixTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)[[](?>\s*)\bunits\b(?>\s*)[^=]*[=](?>\s*)(?<begin>[(])(?>(?>\s*)(?=\S)(?>(?<temperaure>(?:cel(?:sius)?)|(?:fahrenheit)|(?:k(?:elv(?:in)?)?)|(?:rankine))|(?<pressure>(?:atm(?:osphere)?)|(?:bar)|(?:centi(?:bar))|(?:centi(?:pasc(?:al)?))|(?:centi(?:psi))|(?:centi(?:torr))|(?:deci(?:bar))|(?:deci(?:pasc(?:al)?))|(?:deci(?:psi))|(?:deci(?:torr))|(?:giga(?:bar))|(?:giga(?:pasc(?:al)?))|(?:giga(?:psi))|(?:giga(?:torr))|(?:kilo(?:bar)|k(?:bar))|(?:kilo(?:pasc(?:al)?)|k(?:pasc(?:al)?))|(?:kilo(?:psi)|k(?:psi))|(?:kilo(?:torr)|k(?:torr))|(?:mega(?:bar))|(?:mega(?:pasc(?:al)?))|(?:mega(?:psi))|(?:mega(?:torr))|(?:micro(?:bar))|(?:micro(?:pasc(?:al)?))|(?:micro(?:psi))|(?:micro(?:torr))|(?:milli(?:bar))|(?:milli(?:pasc(?:al)?))|(?:milli(?:psi))|(?:milli(?:torr))|(?:nano(?:bar))|(?:nano(?:pasc(?:al)?))|(?:nano(?:psi))|(?:nano(?:torr))|(?:pasc(?:al)?)|(?:psi)|(?:torr))|(?<fraction>x(?>100%?)?|y(?>100%?)?)|(?<defect>\S+))(?>\s*)[,;|]?(?>\s*))*(?<end-begin>[)])()(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	

		public static GMixUnits Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<GMixUnits>(text);
		}


		public GMixUnits(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixUnits(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixUnits(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("GMixUnits");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				if( match.Groups["temperaure"].Success)
				{
					this.TemperatureUnits = ( new GMixTemperatureUnits(arg, match.Groups["temperaure"]) ).GMixTUnits;
				}
				 
				if( match.Groups["pressure"].Success)
				{
					this.PressureUnits = ( new GMixPressureUnits(arg, match.Groups["pressure"]) ).GMixPUnits;
				}
				 
				if( match.Groups["fraction"].Success)
				{
					this.FractionType = ( new GMixFractionType(arg, match.Groups["fraction"]) ).FractionType;
				}
				  

				 

				 

										
				   
				   
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

			

			

			

			

		 
		/// <summary>
        /// TemperatureUnits
        /// </summary>
		public GMixTUnits? TemperatureUnits { get; private set; }   
		/// <summary>
        /// PressureUnits
        /// </summary>
		public GMixPUnits? PressureUnits { get; private set; }   
		/// <summary>
        /// FractionType
        /// </summary>
		public FractionType? FractionType { get; private set; }  	


		 
		 

		 	
	} 
     
	public partial class GMixComponentItem : GMixTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)(?=\S)(?:(?:[\[](?>\s*)(?>(?<knowntype>\b(?:(?>(?:base\s*)?(?:pressure|press?|p))|(?>(?:base\s*)?(?:temp(?>erature)?|t))|(?>comp(?>res(?>sion)?)?\s+ratio|cr)|(?>mach(?>\s*num(?>ber)?)?)|(?>eq(?>uivalence)?\s*ratio|er)|(?>mix(?>ture)?\s*frac(>?tion)?|mf|z))\b)|(?<component>[^\[\]\s]+(?>\s+[^\[\]\s]+)*))(?>\s*)[\]])|(?<species>[^\s\[\]]+))(?>\s*)=(?>\s*)(?>(?<null>[?])|(?>(?>@param(?:eter)?)(?<param>[^)]+[)]?))|(?<value>\S+))(?>\s*))$", RegexOptions.Compiled);
		 	
         	
         
		private readonly List<double> m_valuesQueue = new List<double>();  	

		public static GMixComponentItem Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<GMixComponentItem>(text);
		}


		public GMixComponentItem(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixComponentItem(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixComponentItem(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("GMixComponentItem");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}     
				foreach(Capture capture in match.Groups["arrayitem"].Captures)
				{
					double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        m_valuesQueue.Add( @value );
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, capture);
                    }
				}
				  
				if( match.Groups["knowntype"].Success)
				{
					this.LhsKnownType = ( new GMixKnownItemType(arg, match.Groups["knowntype"]) ).KnownItemType;
				}
				  
				if( match.Groups["percents"].Success 
					&& Regex.IsMatch( match.Groups["percents"].Value, @"^(?:%)$") )
				{
					this.IsStepRelative = true;
				}
				 

				 
                for(int counter = 0; counter < match.Groups["component"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["component"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
					this.ComponentID = arg.MapString(capture.Value);   
				}  
                for(int counter = 0; counter < match.Groups["species"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["species"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
					this.SpeciesID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["value"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["value"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Value = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["value"]);
                    }
				}  

										
				 		
				for(int counter = 0; counter < match.Groups["param"].Captures.Count; ++counter)	
				{
					Capture capture = match.Groups["param"].Captures[counter];
					this.Parameter = new GMixParameter(arg, capture);
					if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
				}    
				   
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ComponentID
        /// </summary>
		public string ComponentID { get; private set; }   
		/// <summary>
        /// SpeciesID
        /// </summary>
		public string SpeciesID { get; private set; }  	

			

		 
		/// <summary>
        /// Value
        /// </summary>
		public double? Value { get; private set; }  	

		 
		/// <summary>
        /// IsStepRelative
        /// </summary>
		public bool IsStepRelative { get; private set; }  	

		 
		/// <summary>
        /// LhsKnownType
        /// </summary>
		public KnownItemType? LhsKnownType { get; private set; }  	


		 
		public GMixParameter Parameter { get; private set; }  
		 

		 
		public IEnumerable<double> ValuesQueue 
		{
			get  { return new ReadOnlyCollection<double>(m_valuesQueue); }
		}  	
	} 
     
	public partial class GMixParameter : GMixTextFragment
	{
		public static readonly Regex ScopeRegex = new Regex(@"^(?:(?s).*)$", RegexOptions.Compiled);
		public static readonly Regex StructureRegex = new Regex(@"^(?:(?s)(?>\s*)[[](?>\s*)(?<param>[^\s\[\]]+)(?>\s*)[]](?>\s*)[(](?>\s*)(?:(?>(?>\s*)\b(?:from)\b(?>\s*)(?>[:](?>\s*))?(?<from>\S+)(?>\s*)(?>[;,](?>\s*))?(?>\s*)\b(?:to|till)\b(?>\s*)(?>[:](?>\s*))?(?<to>\S+)(?>\s*)(?>[;,](?>\s*))?(?>\s*)\b(?:step|increment|seed)\b(?>\s*)(?>[:](?>\s*))?(?<increment>[^\s%()]+)(?>\s*)(?<percents>[%]?)(?>\s*))|(?>(?<arrayitem>[^\s,;]+)(\s+([,;](?>\s*))?(?<arrayitem>[^\s,;]+)){1,}))(?>\s*)[)](?>\s*))$", RegexOptions.Compiled);
		 	
         	
         	

		public static GMixParameter Parse(string text) 
		{
			TextSerializer textSerializer = new TextSerializer();
			return textSerializer.Deserialize<GMixParameter>(text);
		}


		public GMixParameter(GMixTextSource source, ITextInfoEventListener listener) : base(source) 
		{
			Initialize(new TextProgressArg(source, listener)); 
		}
		internal GMixParameter(TextProgressArg arg, System.Text.RegularExpressions.Capture capture) : base(arg.Source, capture) { Initialize(arg); }
		internal GMixParameter(TextProgressArg arg, int index, int length) : base(arg.Source, index, length) { Initialize(arg); }
		

		void Initialize(TextProgressArg arg)
        {
			var listener = arg.Listener;
			arg.Stack.Push("GMixParameter");
			try
			{		
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
				{		
					TextTrace.TraceEvent(TraceEventType.Verbose, 0, "Path : {0}", arg.LogicalPath);
				}
				Match match = StructureRegex.Match(this);
				if( !match.Success )
				{
					listener.Submit(TextInfoType.Error, "Invalid format", this);
					var position = arg.Source[this.Index];    
					if (TextTrace.Switch.ShouldTrace(TraceEventType.Error))
					{                
						TextTrace.TraceEvent(TraceEventType.Error, 0, "Path : {0} > Failed to match the scope > Line: {1}", arg.LogicalPath, position.Line);
						TextTrace.TraceData(TraceEventType.Error, 0, this.AdaptedText);			
					}		
					return;
				}      
				if( match.Groups["percents"].Success 
					&& Regex.IsMatch( match.Groups["percents"].Value, @"^(?:%)$") )
				{
					this.IsIncrementRelative = true;
				}
				 

				 
                for(int counter = 0; counter < match.Groups["param"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["param"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
					this.ParameterID = arg.MapString(capture.Value);   
				}  

				 
                for(int counter = 0; counter < match.Groups["from"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["from"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.LowerLimit = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["from"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["to"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["to"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.UpperLimit = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["to"]);
                    }
				}  
                for(int counter = 0; counter < match.Groups["increment"].Captures.Count; ++counter)	
				{
                    Capture capture = match.Groups["increment"].Captures[counter];
                    if( counter > 1 )
					{
						listener.Submit(TextInfoType.Error, "Duplicate entry", this.Source, match);
					}
                    double @value = 0.0d;
                    if( double.TryParse(capture.Value, NumberStyles.Any, CultureInfo.InvariantCulture, out @value) )
                    {
                        this.Increment = value;   
                    }
                    else
                    {
                        listener.Submit(TextInfoType.Error, "Expected real number", this.Source, match.Groups["increment"]);
                    }
				}  

										
				   
				   
			}
			catch(Exception ex)
			{
				TextTrace.TraceEvent(TraceEventType.Critical, 0, "Exception: {0}", ex.Message);
                TextTrace.TraceData(TraceEventType.Critical, 0, ex);
				throw ex;
			}
			finally
			{
				arg.Stack.Pop();
				if (TextTrace.Switch.ShouldTrace(TraceEventType.Verbose))
                {
					TextTrace.TraceEvent(TraceEventType.Information, 0, "Path : {0} > done", arg.LogicalPath);
				}
			}
		}

		 
		/// <summary>
        /// ParameterID
        /// </summary>
		public string ParameterID { get; private set; }  	

			

		 
		/// <summary>
        /// LowerLimit
        /// </summary>
		public double LowerLimit { get; private set; }   
		/// <summary>
        /// UpperLimit
        /// </summary>
		public double UpperLimit { get; private set; }   
		/// <summary>
        /// Increment
        /// </summary>
		public double Increment { get; private set; }  	

		 
		/// <summary>
        /// IsIncrementRelative
        /// </summary>
		public bool IsIncrementRelative { get; private set; }  	

			


		 
		 

		 	
	} 
    

}